package com.provider.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class ProviderController {


    @Value("${zookeeper.connect}")
    private String test;


    @GetMapping("/providerTest01")
    @ConditionalOnProperty(name = "method.enabled", havingValue = "false")
    public String test01() {
        String msg = "调用了服务为9002端口服务";
        System.out.println(msg);
        return  msg+test;
    }

    /*
     接受token
     */
    @RequestMapping("/providerTest02")
    public String test02(@RequestHeader("Token") String token) {
        System.out.println("token为："+token);
        return  token;
    }


    /*
     */
    @GetMapping("/test")
    public String test() {
        return  "访问了服务9002";
    }
}
